In an existing portable electronic device such as a mobile phone, a tablet computer, or a media player, the device needs to learn an insertion status of a headset, namely, whether the headset is inserted into the portable electronic device and whether the headset is half inserted or fully inserted. After the portable electronic device learns the insertion status of the headset, the portable electronic device may perform a corresponding operation. For example, after learning that the headset is inserted, the device starts to turn on an interface between media player software and headset driver software. In a typical application scenario, headset insertion detection is performed by a circuit in the portable electronic device.
Because a headset plug part is generally metallic, when a headset plug is inserted into a headset jack, namely, a headset hole, of the portable electronic device, whether the headset plug is inserted into the headset jack is detected by means of voltage change between two contacts (or pins), namely, DET and L, on the headset jack. A simplified headset jack structure is shown in FIG. 1. Both the DET contact and the L contact are capable of elastic deformation and available for detecting whether a headset is inserted. In addition, the L contact may also be used by the portable electronic device to transmit an audio-left channel signal to the headset. Other contacts also exist in the headset jack. For example, an R contact is used by the portable electronic device to transmit an audio-right channel signal to the headset, a GND contact is used for grounding, and M is used to transmit a sound generated by the headset, namely, a microphone signal, to the portable electronic device. Electronic connection may not exist between the two contacts DET and L of the headset jack before the headset is inserted. Once the headset plug is inserted into the headset jack, the DET contact is short-circuited, namely, electrically connected, to the L contact. In this case, a voltage at the DET contact changes, and a circuit electrically connected to the DET contact can identify the change of the voltage and send a notification signal to bottom-layer driver software in the portable electronic device, so that the software performs a corresponding operation to enable the portable electronic device to use the headset normally.
In another solution in the prior art, a DET contact may keep short-circuited to an L contact on a headset jack when no headset is inserted, and the DET contact may become open-circuited with the L contact after a headset is inserted. That is, insertion of the headset leads to electrical disconnection. In this case, an electrical characteristic of the DET contact also changes, and therefore, a circuit connected to the DET contact may also generate a notification signal based on the voltage change.
Due to a design of an existing headset jack, when a headset plug is half inserted, an electrical connection relationship between the DET contact and the L contact already changes. Although the headset is not inserted fully in this case, namely, is not inserted in position, which may lead to poor contact of several contacts (or pins) such as R, GND, or M, and make the headset plug unable to suit the headset jack properly, thereby leading to an exception condition. In this case, software of a portable electronic device may need to use a more sophisticated voltage threshold detection solution to further determine whether the headset is inserted in position currently, namely, determine whether the headset plug is fully inserted into the headset jack.
A typical existing solution to detecting whether the headset is inserted in position is to detect a voltage division relationship in a detection circuit in different insertion statuses. However, existing headsets come in many types. Common headsets come in three types: a tip-ring-sleeve headset, a US-standard headset (LRGM), and an international standard headset (LRMG). Different headset plugs have different impedance, which causes that structures of headset jacks may be not consistent completely and causes a quite complicated status of connection between the headset plug and the headset jack in an insertion process, and therefore causes many different values in the voltage division relationship of the DET contact. Therefore, complicated circuit hardware design and software state machine design are required in the existing solution to determining, by detecting the voltage division relationship in the circuit, whether the headset is inserted in position, which increases product implementation costs.